package com.heima.wemedia.feign;

import com.heima.common.dtos.ResponseResult;
import com.heima.model.wemedia.dtos.WmSensitiveDto;
import com.heima.model.wemedia.pojos.WmChannel;
import com.heima.model.wemedia.pojos.WmUser;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

@FeignClient("leadnews-wemedia")
public interface WemediaFeign {

    /**
     * 查询所有频道
     */
    @GetMapping("/api/v1/channel/channels")
    public ResponseResult<List<WmChannel>> findList();

    /**
     * 查询敏感词列表
     * @param dto
     * @return
     */
    @PostMapping("/api/v1/sensitive/Sensitive")
    public ResponseResult findSensitiveList(@RequestBody WmSensitiveDto dto);

    @PostMapping("/api/v1/wemedia/user/save")
    public ResponseResult saveWmUser(@RequestBody WmUser wmUser);

    /**
     * 查询文章作者信息
     * @param articleId
     * @return
     */
    @RequestMapping("/api/v1/findByNewsId")
    public ResponseResult<WmUser> findByNewsId(@RequestBody Long articleId);

    /**
     * 查询所有违规词并存储在Redis
     */
    @GetMapping("/api/v1/sensitive/findAll")
    public ResponseResult<List<String>> findAllAndRedis();
}
